//--------------------------------------- NOTES ------------------------------------------------------// 
* This table is Table 7 in the paper
//--------------------------------------------------------------------------------------------------------//

cd  "/YOUR_LOCAL_DIRECTORY" //setting the working directory
clear all //remove all data, labels, matrices etc (incl. Mata functions)
use December8ChanRoth, clear

* Create the key treatment variable
gen byte status_quo = treatment=="status_quo"
la var status_quo  "Status Quo"

* Create Y variable
gen byte offer_rate = player1action=="Offer" 

** Missed opportunity
gen byte missedopportunity = player1bluecount>player2lowbluecount & player1action!="Offer" 
replace missedopportunity = 1 if player1bluecount>player2highbluecount & player1action!="Offer" 

* Make table

eststo clear

eststo: quietly reg offer_rate status_quo,  vce(cluster room) // Compare kidney recovery rate (jar offer rate) by treatment group
eststo: quietly reg offer_rate status_quo if player1jartype=="low_quality",  vce(cluster room)  // Compare kidney recovery rate (jar offer rate) by treatment group, CONDITIONAL on jar being LOW quality
eststo: quietly reg offer_rate status_quo if player1jartype=="high_quality",  vce(cluster room)   // Compare kidney recovery rate (jar offer rate) by treatment group, CONDITIONAL on jar being HIGH quality

eststo: quietly reg missedopportunity status_quo,  vce(cluster room) // Compare missed opportunity rate by treatment group
eststo: quietly reg missedopportunity status_quo if player1jartype=="low_quality",  vce(cluster room)  // Compare missed opportunity rate by treatment group, CONDITIONAL on jar being LOW quality
eststo: quietly reg missedopportunity status_quo if player1jartype=="high_quality",  vce(cluster room)   // Compare missed opportunity rate by treatment group, CONDITIONAL on jar being HIGH quality\

local titles "& All & Low Quality & High Quality & All & Low Quality & High Quality \\"
local numbers "& (1) & (2) & (3) & (4) & (5) & (6) \\ \hline"

esttab using table_recoveryrate_alt.tex, se r2  keep(status_quo _cons) star(+ 0.1 * 0.05 ** 0.01) b(3) mgroups("Jar Recovery Rate" "Missed Beneficial Recovery", pattern(1 0 1 0) prefix(\multicolumn{3}{c}{) suffix(}) span) mlabels(none) nonumbers posthead("`titles'" "`numbers'") label  title("Impact on Jar Recovery Rates and Missed Opportunities for Beneficial Recoveries for Alternative Sample") substitute([htbp] [!htbp] \begin{tabular} \small\begin{tabular} {l} {p{\linewidth}}) addnotes("(Robust, clustered by player-pairings)") stat(N r2, label("N" "\[R^2\]") fmt(a3 %9.3fc))

